<?php
require_once (dirname(__FILE__).'/include/common.inc.php');


# 页面级别
# 0 = 所有人都可以访问
$conf_web_page_level = 0; 

class myPage extends page{
	
	function hnews_listview(){
		$lv;
		try{
			$sql = "
				SELECT hnewsId, title, contents, dates
				FROM cs2_hnews 
				ORDER BY cs2_hnews.dates DESC  LIMIT 0,10;";
			$lv = $this->database->select($sql);
		}catch (Exception $e) {
			$lv = null;
		}
		return $lv;
	}
	function ajax_callback(){
		parent::ajax_callback();
		return json_encode($this->ajax_json);
	}
}
/*
#test
$url = 'http://rss.dailynews.yahoo.co.jp/fc/rss.xml';
$rss = fetch_rss($url);
echo "Site: ", $rss->channel['title'], "<br>";
foreach ($rss->items as $item ) {
	$title = $item[title];
	$url   = $item[link];
	echo "<a href=$url>$title</a></li><br>";
}
*/

$pg = new myPage();
# 载入页面
if($_SERVER['REQUEST_METHOD'] != 'POST'){
	
	$config->smarty->assign('hnews_listview', $pg->hnews_listview());
	# 加载页面
	$pg->render($config->temp_page_path);
}else{
	print_r($pg->ajax_callback());
}


?>